<template>
    <div>
<van-skeleton title :row="3" />
<van-row>
  <van-col span="6">
    <van-sidebar v-model="active" >
  <van-sidebar-item :title="item.cat_name" v-for="item in categoriesApiData"/>
</van-sidebar>
  </van-col>
  <van-col span="18">
    <div v-for="item in categoriesApiData[active]?.children">
        <h3>{{ item.cat_name }}</h3>
        <router-link :to="{name:'goods',params:{query:item.cat_name}}">
        <van-grid :column-num="3">
  <van-grid-item v-for="value in item.children" :key="value" :icon="value.cat_icon" :text="value.cat_name"/>
</van-grid>
</router-link>
    </div>
  </van-col>
</van-row>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { categoriesApi } from '@/api/api';
let categoriesApiData=ref([])
categoriesApi().then(res=>{
    categoriesApiData.value=res.data.message
    console.log(res);
    
})
const active = ref(1);
</script>

<style lang="scss" scoped>

</style>